<template>
  <view class="ai-bubble" :class="[type, position]" :date-type="type">
    <slot></slot>
  </view>
</template>

<script>
  export default {
    name: "ai-bubble",
    props: {
      type: String,
      position: String
    },
    data() {
      return {

      };
    }
  }
</script>

<style lang="scss">
  @import "@/styles/_var.scss";

  .ai-bubble {
    max-width: $bubble-max-width;
    // min-width: 0;
    min-width: 1px; // for IE bug
    background: $bubble-def-color;
    border-radius: $bubble-def-border-radius;
    line-height: 1.7;
    box-sizing: border-box;
    box-shadow: var(--shadow-1);
    overflow: hidden;

    &.text,
    &.typing {
      min-width: 40px;
      padding: $bubble-text-padding;
      box-sizing: border-box;
      white-space: pre-wrap;
      word-wrap: break-word;
      overflow-wrap: break-word;
    }
    
    &.left {
      background: $bubble-left-bg;
    }
    
    &.right {
      background: $bubble-right-bg;
    }
    
    &.left:not(.card) {
      border-radius: $bubble-left-border-radius;
      background: $bubble-left-bg;
    }
    
    &.right:not(.card) {
      border-radius: $bubble-right-border-radius;
      background: $bubble-right-bg;
    }

    &.image {
      img,
      .img {
        display: block;
        max-width: $bubble-img-max-width;
        max-height: $bubble-img-max-height;
        height: auto;
        border-radius: inherit;
      }
    }
  }
</style>